/// 字符串扩展方法
extension StringExtension on String {
  /// 不为空
  bool get isNotEmptyOfNull {
    return !this.isEmptyOfNull;
  }

  /// 为空
  bool get isEmptyOfNull {
    return this.isEmpty;
  }

  /// 范围替换保持长度
  String replaceRangeKeepLength(
      {required int prefixCount,
      required int suffixCount,
      String symbol = '*'}) {
    if (this.length == 0) {
      return this;
    }
    if (this.length < (prefixCount + suffixCount)) {
      return this;
    }
    return this.replaceRange(prefixCount, this.length - suffixCount,
        ' ${symbol * (this.length - prefixCount - suffixCount)} ');
  }
}
